﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cnFederal.Controls
{
    public partial class DevxVideoCtrl : System.Web.UI.UserControl
    {
            List<Fvideo> _videoList;
        int _pager;
        #region init settings
        // player width
        private int _W = 250;

        // player height
        private int _H = 200;

        // autoplay disabled
        bool auto = false;
        #endregion
        public DevxVideoCtrl()
        {
            Fvideos.Load(true);
            _videoList = Fvideos.GetTopVideos(5);
            _pager = 0;
        }

        public string GetYoutubeUrl(string youtubeCode)
        {
           return YouTubeScript.Get(youtubeCode, false,
            _W, _H, true, "maroon", "", 15);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ASPxImageSlider1.DataSource = _videoList;

            ASPxImageSlider1.DataBind();
            int i = 0;
            foreach (var s in _videoList)
            {
                ASPxImageSlider1.Items[i].NavigateUrl = Common.GetAbsoluteUri(@"~/Fa-Forms/SelectedContent.aspx?Id=" + s.Id);
                ASPxImageSlider1.Items[i++].Text = s.Title;

            }
        }
    }
}